﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SERP.Controllers;
using SERP.DAO;
using System.Collections.Generic;
public partial class Main : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int moduleid = 1;
        ModulesEntity oModule = null;
        if (Request["Module"] != null)
        {
            oModule = ModulesController.FindModuleByCode(Request["Module"]);
            moduleid = oModule.ModuleId;
            lblMod.Text = oModule.Description.ToUpper();
        }
        if (oModule != null)
        {
            List<MenusEntity> ls = MenusController.GetMenusByParentModule(0, moduleid);
            /*mnu.DataSource=ls;
            mnu.DataBind();
            */
            foreach (MenusEntity o in ls)
            {
                MenuItem item = new MenuItem();
                item.Text = o.MenuName;
                item.NavigateUrl = Request.Url.AbsolutePath + "?Module=" + oModule.ModuleName + "&pmid=" + o.MenuId.ToString() + "&" + o.MenuUrl;
                mnu.Items.Add(item);
            }
        }
    }
}
